import book.BookList;
import operation.IOperation;
import user.Admit;
import user.NormalUser;
import user.User;

import java.util.Scanner;

public class Main {
    public static User login() {
        System.out.print("请输入名字-->");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        System.out.println(" 1---图书管理员  2---普通用户  ");
        System.out.print("请选择身份-->");
        int choice = scanner.nextInt();
        if(choice == 1) {
            return new Admit(name);
        }else{
            return new NormalUser(name);
        }
    }




    public static void main(String[] args) {

        BookList bookList = new BookList();
        //用户登录
        User user = login();
        //打印菜单
        //用户选择操作
        while(true) {
            int choice = user.menu();
            user.doOperation(choice,bookList);
        }
//        IOperation[] iOperations = user.getiOperations();
//        IOperation iOperation = iOperations[choice];
//        iOperation.work();




    }
}
